package com.xinzhi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xinzhi.pojo.BankCard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
@Mapper
public interface BankCardMapper extends BaseMapper<BankCard> {

    @Select("SELECT * FROM bankcard WHERE phone = #{phone}")
    BankCard selectByPhone(@Param("phone") String phone);

    @Update("UPDATE bankcard SET card_money = #{balance} WHERE card_id = #{cardId}")
    void updateBalance(@Param("cardId") Integer cardId, @Param("balance") BigDecimal balance);
}
